package cn.tedu.csmall.passport.config;

import cn.tedu.csmall.passport.service.impl.RoleServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;

@Slf4j
@Configuration
@EnableScheduling
public class ScheduleConfiguration {

    @Autowired
    RoleServiceImpl roleService;

    public ScheduleConfiguration(){
        log.debug("创建配置类对象: ScheduleConfiguration");
    }

    @Scheduled(fixedRate = 1*60*1000)
    public void rebuildRoleCache(){
        roleService.rebuildCache();
    }
}
